<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>配置 | 赵小云学习笔记</title>
    <meta name="generator" content="VuePress 1.8.0">
    <link rel="icon" href="/logo.png">
    <link rel="manifest" href="/manifest.json">
    <link rel="apple-touch-icon" href="/icons/apple-touch-icon-152x152.png">
    <link rel="mask-icon" href="/icons/safari-pinned-tab.svg" color="#3eaf7c">
    <script data-ad-client="ca-pub-2245427233262012" async="true" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <meta name="description" content="愿半生编码，如一生好友。">
    <meta name="theme-color" content="#3eaf7c">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="msapplication-TileImage" content="/icons/msapplication-icon-144x144.png">
    <meta name="msapplication-TileColor" content="#000000">
    
    <link rel="preload" href="/assets/css/0.styles.fca152ce.css" as="style"><link rel="preload" href="/assets/js/app.28715422.js" as="script"><link rel="preload" href="/assets/js/5.cdfc0b9f.js" as="script"><link rel="preload" href="/assets/js/22.32e1eb60.js" as="script"><link rel="preload" href="/assets/js/9.4c44b987.js" as="script"><link rel="prefetch" href="/assets/js/10.84acbb53.js"><link rel="prefetch" href="/assets/js/11.702efeb3.js"><link rel="prefetch" href="/assets/js/12.589fb250.js"><link rel="prefetch" href="/assets/js/13.5b7e8614.js"><link rel="prefetch" href="/assets/js/14.a954bfd1.js"><link rel="prefetch" href="/assets/js/15.bd11c63a.js"><link rel="prefetch" href="/assets/js/16.b4fb7988.js"><link rel="prefetch" href="/assets/js/17.61d84266.js"><link rel="prefetch" href="/assets/js/18.24a2bff9.js"><link rel="prefetch" href="/assets/js/19.43d31d8f.js"><link rel="prefetch" href="/assets/js/20.b22f54d0.js"><link rel="prefetch" href="/assets/js/21.9c07bc91.js"><link rel="prefetch" href="/assets/js/23.093427d3.js"><link rel="prefetch" href="/assets/js/24.e648d309.js"><link rel="prefetch" href="/assets/js/25.d7282ca4.js"><link rel="prefetch" href="/assets/js/26.35acf93d.js"><link rel="prefetch" href="/assets/js/27.56ca4ce1.js"><link rel="prefetch" href="/assets/js/28.93379c82.js"><link rel="prefetch" href="/assets/js/29.51d63262.js"><link rel="prefetch" href="/assets/js/30.1b336946.js"><link rel="prefetch" href="/assets/js/31.e297de45.js"><link rel="prefetch" href="/assets/js/32.4bae9555.js"><link rel="prefetch" href="/assets/js/33.4239fd2e.js"><link rel="prefetch" href="/assets/js/34.bbc16b3c.js"><link rel="prefetch" href="/assets/js/35.f16977ac.js"><link rel="prefetch" href="/assets/js/36.6141cdc8.js"><link rel="prefetch" href="/assets/js/37.43f5a7f6.js"><link rel="prefetch" href="/assets/js/38.01c53507.js"><link rel="prefetch" href="/assets/js/39.21f63708.js"><link rel="prefetch" href="/assets/js/40.f9f38954.js"><link rel="prefetch" href="/assets/js/41.0175e1f4.js"><link rel="prefetch" href="/assets/js/42.422cba18.js"><link rel="prefetch" href="/assets/js/43.3d77a131.js"><link rel="prefetch" href="/assets/js/44.aab84de2.js"><link rel="prefetch" href="/assets/js/45.ac7ca1c5.js"><link rel="prefetch" href="/assets/js/46.9982952d.js"><link rel="prefetch" href="/assets/js/47.d4c85adf.js"><link rel="prefetch" href="/assets/js/48.d00a7fe9.js"><link rel="prefetch" href="/assets/js/49.03487062.js"><link rel="prefetch" href="/assets/js/50.bbfd00cd.js"><link rel="prefetch" href="/assets/js/51.1ef38ba0.js"><link rel="prefetch" href="/assets/js/52.f352c22a.js"><link rel="prefetch" href="/assets/js/53.fa377a7b.js"><link rel="prefetch" href="/assets/js/54.16d81c63.js"><link rel="prefetch" href="/assets/js/55.b2e1b9f2.js"><link rel="prefetch" href="/assets/js/56.99f69695.js"><link rel="prefetch" href="/assets/js/57.54be906e.js"><link rel="prefetch" href="/assets/js/58.e28944e4.js"><link rel="prefetch" href="/assets/js/59.647fcd7b.js"><link rel="prefetch" href="/assets/js/6.8f67e34e.js"><link rel="prefetch" href="/assets/js/60.ed875cf2.js"><link rel="prefetch" href="/assets/js/61.d244e754.js"><link rel="prefetch" href="/assets/js/62.82572383.js"><link rel="prefetch" href="/assets/js/63.afac6e14.js"><link rel="prefetch" href="/assets/js/64.1793ed0c.js"><link rel="prefetch" href="/assets/js/65.75847d31.js"><link rel="prefetch" href="/assets/js/66.a613f673.js"><link rel="prefetch" href="/assets/js/67.374e7e54.js"><link rel="prefetch" href="/assets/js/7.2df5fd3a.js"><link rel="prefetch" href="/assets/js/8.79c44677.js"><link rel="prefetch" href="/assets/js/vendors~docsearch.b3708bf9.js"><link rel="prefetch" href="/assets/js/vendors~flowchart.3b4fa92d.js"><link rel="prefetch" href="/assets/js/vendors~notification.11c6c6d5.js">
    <link rel="stylesheet" href="/assets/css/0.styles.fca152ce.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">赵小云学习笔记</span></a> <div class="links"><form id="search-form" role="search" class="algolia-search-wrapper search-box"><input id="algolia-search-input" class="search-query"></form> <nav class="nav-links can-hide"><div class="nav-item"><a href="/notes/" class="nav-link">
  notes
</a></div><div class="nav-item"><a href="/guide/" class="nav-link">
  指南
</a></div><div class="nav-item"><a href="/config/" aria-current="page" class="nav-link router-link-exact-active router-link-active">
  配置
</a></div><div class="nav-item"><a href="/plugin/" class="nav-link">
  插件
</a></div><div class="nav-item"><a href="/theme/" class="nav-link">
  主题
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="了解更多" class="dropdown-title"><span class="title">了解更多</span> <span class="arrow down"></span></button> <button type="button" aria-label="了解更多" class="mobile-dropdown-title"><span class="title">了解更多</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>
          API
        </h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/zh/api/cli.html" class="nav-link">
  CLI
</a></li><li class="dropdown-subitem"><a href="/zh/api/node.html" class="nav-link">
  Node
</a></li></ul></li><li class="dropdown-item"><h4>
          开发指南
        </h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/zh/miscellaneous/local-development.html" class="nav-link">
  本地开发
</a></li><li class="dropdown-subitem"><a href="/zh/miscellaneous/design-concepts.html" class="nav-link">
  设计理念
</a></li><li class="dropdown-subitem"><a href="/zh/faq/" class="nav-link">
  FAQ
</a></li><li class="dropdown-subitem"><a href="/zh/miscellaneous/glossary.html" class="nav-link">
  术语
</a></li></ul></li><li class="dropdown-item"><h4>
          其他
        </h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/zh/miscellaneous/migration-guide.html" class="nav-link">
  从 0.x 迁移
</a></li><li class="dropdown-subitem"><a href="https://github.com/vuejs/vuepress/blob/master/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="nav-link external">
  Changelog
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li></ul></div></div><div class="nav-item"><a href="https://v0.vuepress.vuejs.org/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  0.x
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <a href="https://github.com/vuejs/vuepress" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/notes/" class="nav-link">
  notes
</a></div><div class="nav-item"><a href="/guide/" class="nav-link">
  指南
</a></div><div class="nav-item"><a href="/config/" aria-current="page" class="nav-link router-link-exact-active router-link-active">
  配置
</a></div><div class="nav-item"><a href="/plugin/" class="nav-link">
  插件
</a></div><div class="nav-item"><a href="/theme/" class="nav-link">
  主题
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="了解更多" class="dropdown-title"><span class="title">了解更多</span> <span class="arrow down"></span></button> <button type="button" aria-label="了解更多" class="mobile-dropdown-title"><span class="title">了解更多</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>
          API
        </h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/zh/api/cli.html" class="nav-link">
  CLI
</a></li><li class="dropdown-subitem"><a href="/zh/api/node.html" class="nav-link">
  Node
</a></li></ul></li><li class="dropdown-item"><h4>
          开发指南
        </h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/zh/miscellaneous/local-development.html" class="nav-link">
  本地开发
</a></li><li class="dropdown-subitem"><a href="/zh/miscellaneous/design-concepts.html" class="nav-link">
  设计理念
</a></li><li class="dropdown-subitem"><a href="/zh/faq/" class="nav-link">
  FAQ
</a></li><li class="dropdown-subitem"><a href="/zh/miscellaneous/glossary.html" class="nav-link">
  术语
</a></li></ul></li><li class="dropdown-item"><h4>
          其他
        </h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/zh/miscellaneous/migration-guide.html" class="nav-link">
  从 0.x 迁移
</a></li><li class="dropdown-subitem"><a href="https://github.com/vuejs/vuepress/blob/master/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="nav-link external">
  Changelog
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li></ul></div></div><div class="nav-item"><a href="https://v0.vuepress.vuejs.org/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  0.x
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <a href="https://github.com/vuejs/vuepress" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>配置</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/config/#基本配置" class="sidebar-link">基本配置</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/config/#base" class="sidebar-link">base</a></li><li class="sidebar-sub-header"><a href="/config/#title" class="sidebar-link">title</a></li><li class="sidebar-sub-header"><a href="/config/#description" class="sidebar-link">description</a></li><li class="sidebar-sub-header"><a href="/config/#head" class="sidebar-link">head</a></li><li class="sidebar-sub-header"><a href="/config/#host" class="sidebar-link">host</a></li><li class="sidebar-sub-header"><a href="/config/#port" class="sidebar-link">port</a></li><li class="sidebar-sub-header"><a href="/config/#temp" class="sidebar-link">temp</a></li><li class="sidebar-sub-header"><a href="/config/#dest" class="sidebar-link">dest</a></li><li class="sidebar-sub-header"><a href="/config/#locales" class="sidebar-link">locales</a></li><li class="sidebar-sub-header"><a href="/config/#shouldprefetch" class="sidebar-link">shouldPrefetch</a></li><li class="sidebar-sub-header"><a href="/config/#cache" class="sidebar-link">cache</a></li><li class="sidebar-sub-header"><a href="/config/#extrawatchfiles" class="sidebar-link">extraWatchFiles</a></li><li class="sidebar-sub-header"><a href="/config/#patterns" class="sidebar-link">patterns</a></li></ul></li><li><a href="/config/#styling" class="sidebar-link">Styling</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/config/#palette-styl" class="sidebar-link">palette.styl</a></li><li class="sidebar-sub-header"><a href="/config/#index-styl" class="sidebar-link">index.styl</a></li></ul></li><li><a href="/config/#主题" class="sidebar-link">主题</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/config/#theme" class="sidebar-link">theme</a></li><li class="sidebar-sub-header"><a href="/config/#themeconfig" class="sidebar-link">themeConfig</a></li></ul></li><li><a href="/config/#pluggable" class="sidebar-link">Pluggable</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/config/#plugins" class="sidebar-link">plugins</a></li></ul></li><li><a href="/config/#markdown" class="sidebar-link">Markdown</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/config/#markdown-linenumbers" class="sidebar-link">markdown.lineNumbers</a></li><li class="sidebar-sub-header"><a href="/config/#markdown-slugify" class="sidebar-link">markdown.slugify</a></li><li class="sidebar-sub-header"><a href="/config/#markdown-anchor" class="sidebar-link">markdown.anchor</a></li><li class="sidebar-sub-header"><a href="/config/#markdown-pagesuffix" class="sidebar-link">markdown.pageSuffix</a></li><li class="sidebar-sub-header"><a href="/config/#markdown-externallinks" class="sidebar-link">markdown.externalLinks</a></li><li class="sidebar-sub-header"><a href="/config/#markdown-toc" class="sidebar-link">markdown.toc</a></li><li class="sidebar-sub-header"><a href="/config/#markdown-plugins" class="sidebar-link">markdown.plugins</a></li><li class="sidebar-sub-header"><a href="/config/#markdown-extendmarkdown" class="sidebar-link">markdown.extendMarkdown</a></li><li class="sidebar-sub-header"><a href="/config/#markdown-extractheaders" class="sidebar-link">markdown.extractHeaders</a></li></ul></li><li><a href="/config/#构建流程" class="sidebar-link">构建流程</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/config/#postcss" class="sidebar-link">postcss</a></li><li class="sidebar-sub-header"><a href="/config/#stylus" class="sidebar-link">stylus</a></li><li class="sidebar-sub-header"><a href="/config/#scss" class="sidebar-link">scss</a></li><li class="sidebar-sub-header"><a href="/config/#sass" class="sidebar-link">sass</a></li><li class="sidebar-sub-header"><a href="/config/#less" class="sidebar-link">less</a></li><li class="sidebar-sub-header"><a href="/config/#configurewebpack" class="sidebar-link">configureWebpack</a></li><li class="sidebar-sub-header"><a href="/config/#chainwebpack" class="sidebar-link">chainWebpack</a></li></ul></li><li><a href="/config/#浏览器兼容性" class="sidebar-link">浏览器兼容性</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/config/#evergreen" class="sidebar-link">evergreen</a></li></ul></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="配置"><a href="#配置" class="header-anchor">#</a> 配置</h1> <h2 id="基本配置"><a href="#基本配置" class="header-anchor">#</a> 基本配置</h2> <h3 id="base"><a href="#base" class="header-anchor">#</a> base</h3> <ul><li>类型: <code>string</code></li> <li>默认值: <code>/</code></li></ul> <p>部署站点的基础路径，如果你想让你的网站部署到一个子路径下，你将需要设置它。如 GitHub pages，如果你想将你的网站部署到 <code>https://foo.github.io/bar/</code>，那么 <code>base</code> 应该被设置成 <code>&quot;/bar/&quot;</code>，它的值应当总是以斜杠开始，并以斜杠结束。</p> <p><code>base</code> 将会作为前缀自动地插入到所有以 <code>/</code> 开始的其他选项的链接中，所以你只需要指定一次。</p> <p><strong>参考:</strong></p> <ul><li><a href="/guide/assets.html#基础路径">Base URL</a></li> <li><a href="/guide/deploy.html#github-pages">部署指南 &gt; GitHub Pages</a></li></ul> <h3 id="title"><a href="#title" class="header-anchor">#</a> title</h3> <ul><li>类型: <code>string</code></li> <li>默认值: <code>undefined</code></li></ul> <p>网站的标题，它将会被用作所有页面标题的前缀，同时，默认主题下，它将显示在导航栏（navbar）上。</p> <h3 id="description"><a href="#description" class="header-anchor">#</a> description</h3> <ul><li>类型: <code>string</code></li> <li>默认值: <code>undefined</code></li></ul> <p>网站的描述，它将会以 <code>&lt;meta&gt;</code> 标签渲染到当前页面的 HTML 中。</p> <h3 id="head"><a href="#head" class="header-anchor">#</a> head</h3> <ul><li>类型: <code>Array</code></li> <li>默认值: <code>[]</code></li></ul> <p>额外的需要被注入到当前页面的 HTML <code>&lt;head&gt;</code> 中的标签，每个标签都可以以 <code>[tagName, { attrName: attrValue }, innerHTML?]</code> 的格式指定，举个例子，增加一个自定义的 favicon：</p> <div class="language-js extra-class"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  head<span class="token operator">:</span> <span class="token punctuation">[</span>
    <span class="token punctuation">[</span><span class="token string">'link'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> rel<span class="token operator">:</span> <span class="token string">'icon'</span><span class="token punctuation">,</span> href<span class="token operator">:</span> <span class="token string">'/logo.png'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span>
  <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre></div><h3 id="host"><a href="#host" class="header-anchor">#</a> host</h3> <ul><li>类型: <code>string</code></li> <li>默认值: <code>'0.0.0.0'</code></li></ul> <p>指定用于 dev server 的主机名。</p> <h3 id="port"><a href="#port" class="header-anchor">#</a> port</h3> <ul><li>类型: <code>number</code></li> <li>默认值: <code>8080</code></li></ul> <p>指定 dev server 的端口。</p> <h3 id="temp"><a href="#temp" class="header-anchor">#</a> temp</h3> <ul><li>Type: <code>string</code></li> <li>Default: <code>/path/to/@vuepress/core/.temp</code></li></ul> <p>指定客户端文件的临时目录。</p> <h3 id="dest"><a href="#dest" class="header-anchor">#</a> dest</h3> <ul><li>类型: <code>string</code></li> <li>默认值: <code>.vuepress/dist</code></li></ul> <p>指定 <code>vuepress build</code> 的输出目录。如果传入的是相对路径，则会基于 <code>process.cwd()</code> 进行解析。</p> <h3 id="locales"><a href="#locales" class="header-anchor">#</a> locales</h3> <ul><li>类型: <code>{ [path: string]: Object }</code></li> <li>默认值: <code>undefined</code></li></ul> <p>提供多语言支持的语言配置。具体细节请查看 <a href="/guide/i18n.html">多语言支持</a>。</p> <h3 id="shouldprefetch"><a href="#shouldprefetch" class="header-anchor">#</a> shouldPrefetch</h3> <ul><li>类型: <code>Function</code></li> <li>默认值: <code>() =&gt; true</code></li></ul> <p>一个函数，用来控制对于哪些文件，是需要生成 <code>&lt;link rel=&quot;prefetch&quot;&gt;</code> 资源提示的。请参考 <a href="https://ssr.vuejs.org/zh/api/#shouldprefetch" target="_blank" rel="noopener noreferrer">shouldPrefetch<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>。</p> <h3 id="cache"><a href="#cache" class="header-anchor">#</a> cache</h3> <ul><li>类型: <code>boolean|string</code></li> <li>默认值: <code>true</code></li></ul> <p>VuePress 默认使用了 <a href="https://github.com/webpack-contrib/cache-loader" target="_blank" rel="noopener noreferrer">cache-loader<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>  来大大地加快 webpack 的编译速度。</p> <p>此选项可以用于指定 cache 的路径，同时也可以通过设置为 <code>false</code> 来在每次构建之前删除 cache。</p> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>这个选项也可以通过命令行来使用：</p> <div class="language-bash extra-class"><pre class="language-bash"><code>vuepress dev docs --cache .cache <span class="token comment"># 设置 cache 路径</span>
vuepress dev docs --no-cache     <span class="token comment"># 在每次构建前删除 cache</span>
</code></pre></div></div> <h3 id="extrawatchfiles"><a href="#extrawatchfiles" class="header-anchor">#</a> extraWatchFiles</h3> <ul><li>类型: <code>Array</code></li> <li>默认值: <code>[]</code></li></ul> <p>指定额外的需要被监听的文件。</p> <p>你可以监听任何想监听的文件，文件变动将会触发 <code>vuepress</code> 重新构建，并实时更新。</p> <div class="language-js extra-class"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  extraWatchFiles<span class="token operator">:</span> <span class="token punctuation">[</span>
    <span class="token string">'.vuepress/foo.js'</span><span class="token punctuation">,</span> <span class="token comment">// 使用相对路径</span>
    <span class="token string">'/path/to/bar.js'</span>   <span class="token comment">// 使用绝对路径</span>
  <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre></div><h3 id="patterns"><a href="#patterns" class="header-anchor">#</a> patterns</h3> <ul><li>Type: <code>Array</code></li> <li>Default: <code>['**/*.md', '**/*.vue']</code></li></ul> <p>Specify which pattern of files you want to be resolved.</p> <h2 id="styling"><a href="#styling" class="header-anchor">#</a> Styling</h2> <h3 id="palette-styl"><a href="#palette-styl" class="header-anchor">#</a> palette.styl</h3> <p>如果要对<a href="https://github.com/vuejs/vuepress/blob/master/packages/@vuepress/core/lib/client/style/config.styl" target="_blank" rel="noopener noreferrer">默认预设<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>的样式进行简单的替换，或者定义一些变量供以后使用，你可以创建一个 <code>.vuepress/styles/palette.styl</code> 文件。</p> <p>你可以调整的一些变量如下:</p> <div class="language-stylus extra-class"><pre class="language-stylus"><code><span class="token comment">// 颜色</span>
<span class="token variable-declaration"><span class="token variable">$accentColor</span> <span class="token operator">=</span> <span class="token hexcode">#3eaf7c</span></span>
<span class="token variable-declaration"><span class="token variable">$textColor</span> <span class="token operator">=</span> <span class="token hexcode">#2c3e50</span></span>
<span class="token variable-declaration"><span class="token variable">$borderColor</span> <span class="token operator">=</span> <span class="token hexcode">#eaecef</span></span>
<span class="token variable-declaration"><span class="token variable">$codeBgColor</span> <span class="token operator">=</span> <span class="token hexcode">#282c34</span></span>
<span class="token variable-declaration"><span class="token variable">$arrowBgColor</span> <span class="token operator">=</span> <span class="token hexcode">#ccc</span></span>
<span class="token variable-declaration"><span class="token variable">$badgeTipColor</span> <span class="token operator">=</span> <span class="token hexcode">#42b983</span></span>
<span class="token variable-declaration"><span class="token variable">$badgeWarningColor</span> <span class="token operator">=</span> <span class="token func"><span class="token function">darken</span><span class="token punctuation">(</span><span class="token hexcode">#ffe564</span><span class="token punctuation">,</span> <span class="token number">35</span><span class="token unit">%</span><span class="token punctuation">)</span></span></span>
<span class="token variable-declaration"><span class="token variable">$badgeErrorColor</span> <span class="token operator">=</span> <span class="token hexcode">#DA5961</span></span>

<span class="token comment">// 布局</span>
<span class="token variable-declaration"><span class="token variable">$navbarHeight</span> <span class="token operator">=</span> <span class="token number">3.6</span><span class="token unit">rem</span></span>
<span class="token variable-declaration"><span class="token variable">$sidebarWidth</span> <span class="token operator">=</span> <span class="token number">20</span><span class="token unit">rem</span></span>
<span class="token variable-declaration"><span class="token variable">$contentWidth</span> <span class="token operator">=</span> <span class="token number">740</span><span class="token unit">px</span></span>
<span class="token variable-declaration"><span class="token variable">$homePageWidth</span> <span class="token operator">=</span> <span class="token number">960</span><span class="token unit">px</span></span>

<span class="token comment">// 响应式变化点</span>
<span class="token variable-declaration"><span class="token variable">$MQNarrow</span> <span class="token operator">=</span> <span class="token number">959</span><span class="token unit">px</span></span>
<span class="token variable-declaration"><span class="token variable">$MQMobile</span> <span class="token operator">=</span> <span class="token number">719</span><span class="token unit">px</span></span>
<span class="token variable-declaration"><span class="token variable">$MQMobileNarrow</span> <span class="token operator">=</span> <span class="token number">419</span><span class="token unit">px</span></span>
</code></pre></div><div class="custom-block danger"><p class="custom-block-title">WARNING</p> <p>你应该<strong>只在</strong>这个文件中定义变量。因为 <code>palette.styl</code> 将在根的 stylus 配置文件的末尾引入，作为配置，它将被多个文件使用，所以一旦你在这里写了样式，你的样式就会被多次复制。</p></div> <h3 id="index-styl"><a href="#index-styl" class="header-anchor">#</a> index.styl</h3> <p>VuePress 提供了一种添加额外样式的简便方法。你可以创建一个 <code>.vuepress/styles/index.styl</code> 文件。这是一个 <a href="http://stylus-lang.com/" target="_blank" rel="noopener noreferrer">Stylus<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 文件，但你也可以使用正常的 CSS 语法。</p> <div class="language-stylus extra-class"><pre class="language-stylus"><code><span class="token selector">.content <span class="token punctuation">{</span></span>
  <span class="token property-declaration"><span class="token property">font-size</span> <span class="token number">30</span><span class="token unit">px</span></span>
<span class="token punctuation">}</span>
</code></pre></div><div class="custom-block warning"><p class="custom-block-title">WARNING</p> <p>由于背后的行为，不论是在 <code>palette.styl</code> 或是 <code>index.styl</code> ，都不能透过 <a href="https://stylus-lang.com/docs/import.html" target="_blank" rel="noopener noreferrer">@import / @require<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 從<strong>相对路径</strong>引用一般的 <code>.css</code> 样式表。</p></div> <details class="custom-block details"><summary>那如果你非得要 import / require 一般的 `.css` 样式表呢？</summary> <p>使用<strong>绝对路径</strong>。</p> <ol><li>从 npm package 引用档案：</li></ol> <div class="language-stylus extra-class"><pre class="language-stylus"><code><span class="token atrule-declaration"><span class="token atrule">@require</span> <span class="token string">'~my-css-package/style.css'</span></span>
</code></pre></div><ol start="2"><li>引用本地档案：</li></ol> <p>因为已经有 <a href="/plugin/option-api.html#alias">alias</a> 这个选项，使用 webpack 别名会是最简单的方式，举例如下：</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token comment">// config.js</span>
 alias<span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token string">'styles'</span><span class="token operator">:</span> path<span class="token punctuation">.</span><span class="token function">resolve</span><span class="token punctuation">(</span>__dirname<span class="token punctuation">,</span> <span class="token string">'./styles'</span><span class="token punctuation">)</span>
  <span class="token punctuation">}</span>
</code></pre></div><div class="language-stylus extra-class"><pre class="language-stylus"><code><span class="token atrule-declaration"><span class="token atrule">@require</span> <span class="token string">'~styles/style.css'</span></span>
</code></pre></div></details> <p><strong>参考:</strong></p> <ul><li><a href="/faq/#为什么不能把-palette-styl-和-index-styl-合并到一个-api">为什么不能把 <code>palette.styl</code> 和 <code>index.styl</code> 合并到一个 API?</a></li></ul> <h2 id="主题"><a href="#主题" class="header-anchor">#</a> 主题</h2> <h3 id="theme"><a href="#theme" class="header-anchor">#</a> theme</h3> <ul><li>类型: <code>string</code></li> <li>默认值: <code>undefined</code></li></ul> <p>当你使用自定义主题的时候，需要指定它。</p> <p><strong>参考:</strong></p> <ul><li><a href="/theme/using-a-theme.html">使用主题</a>.</li></ul> <h3 id="themeconfig"><a href="#themeconfig" class="header-anchor">#</a> themeConfig</h3> <ul><li>类型: <code>Object</code></li> <li>默认值: <code>{}</code></li></ul> <p>为当前的主题提供一些配置，这些选项依赖于你正在使用的主题。</p> <p><strong>也可以参考:</strong></p> <ul><li><a href="/theme/default-theme-config.html">默认主题</a>。</li></ul> <h2 id="pluggable"><a href="#pluggable" class="header-anchor">#</a> Pluggable</h2> <h3 id="plugins"><a href="#plugins" class="header-anchor">#</a> plugins</h3> <ul><li>类型: <code>Object|Array</code></li> <li>默认值: <code>undefined</code></li></ul> <p>请参考 <a href="/plugin/using-a-plugin.html">plugin &gt; Using a plugin</a> 来使用一个插件。</p> <h2 id="markdown"><a href="#markdown" class="header-anchor">#</a> Markdown</h2> <h3 id="markdown-linenumbers"><a href="#markdown-linenumbers" class="header-anchor">#</a> markdown.lineNumbers</h3> <ul><li>类型: <code>boolean</code></li> <li>默认值: <code>undefined</code></li></ul> <p>是否在每个代码块的左侧显示行号。</p> <p><strong>参考:</strong></p> <ul><li><a href="/guide/markdown.html#行号">行号</a></li></ul> <h3 id="markdown-slugify"><a href="#markdown-slugify" class="header-anchor">#</a> markdown.slugify</h3> <ul><li>类型: <code>Function</code></li> <li>默认值: <a href="https://github.com/vuejs/vuepress/tree/master/packages/@vuepress/shared-utils/src/slugify.ts" target="_blank" rel="noopener noreferrer">source<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <p>一个将标题文本转换为 slug 的函数。修改它会影响 <a href="/miscellaneous/glossary.html#headers">标题</a>、<a href="/guide/markdown.html#目录">目录</a>、以及<a href="/theme/default-theme-config.html#侧边栏">侧边栏</a>链接的 id 和 链接。</p> <h3 id="markdown-anchor"><a href="#markdown-anchor" class="header-anchor">#</a> markdown.anchor</h3> <ul><li>类型: <code>Object</code></li> <li>默认值: <code>{ permalink: true, permalinkBefore: true, permalinkSymbol: '#' }</code></li></ul> <p><a href="https://github.com/valeriangalliat/markdown-it-anchor" target="_blank" rel="noopener noreferrer">markdown-it-anchor<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 的选项。</p> <h3 id="markdown-pagesuffix"><a href="#markdown-pagesuffix" class="header-anchor">#</a> markdown.pageSuffix</h3> <ul><li>类型: <code>string</code></li> <li>默认值: <code>.html</code></li></ul> <p>Option to customize internal links to be compatible when using the <a href="https://vuepress.github.io/en/plugins/clean-urls/" target="_blank" rel="noopener noreferrer">vuepress-plugin-clean-urls<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p> <h3 id="markdown-externallinks"><a href="#markdown-externallinks" class="header-anchor">#</a> markdown.externalLinks</h3> <ul><li>类型: <code>Object</code></li> <li>默认值: <code>{ target: '_blank', rel: 'noopener noreferrer' }</code></li></ul> <p>这个键值对将会作为特性被增加到是外部链接的 <code>&lt;a&gt;</code> 标签上，默认的选项将会在新窗口中打开一个该外部链接。</p> <h3 id="markdown-toc"><a href="#markdown-toc" class="header-anchor">#</a> markdown.toc</h3> <ul><li>类型: <code>Object</code></li> <li>默认值: <code>{ includeLevel: [2, 3] }</code></li></ul> <p><a href="https://github.com/Oktavilla/markdown-it-table-of-contents" target="_blank" rel="noopener noreferrer">markdown-it-table-of-contents<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 的选项。</p> <h3 id="markdown-plugins"><a href="#markdown-plugins" class="header-anchor">#</a> markdown.plugins</h3> <p>你可以使用 <code>markdown.plugins</code> 来安装 markdown-it 插件。它的使用方法与<a href="/plugin/using-a-plugin.html#using-a-plugin">安装一个 VuePress 插件</a>类似。你可以使用 Babel 语法或对象语法。<code>markdown-it-</code> 前缀同样是可以忽略的。</p> <div class="language-js extra-class"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  markdown<span class="token operator">:</span> <span class="token punctuation">{</span>
    plugins<span class="token operator">:</span> <span class="token punctuation">[</span>
      <span class="token string">'@org/foo'</span><span class="token punctuation">,</span> <span class="token comment">// 等价于 @org/markdown-it-foo，如果对应的包存在</span>
      <span class="token punctuation">[</span><span class="token string">'markdown-it-bar'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
        <span class="token comment">// 提供你的选项</span>
      <span class="token punctuation">}</span><span class="token punctuation">]</span>
    <span class="token punctuation">]</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div><p>or</p> <div class="language-js extra-class"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  markdown<span class="token operator">:</span> <span class="token punctuation">{</span>
    plugins<span class="token operator">:</span> <span class="token punctuation">{</span>
      <span class="token string">'@org/foo'</span><span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
      <span class="token string">'markdown-it-bar'</span><span class="token operator">:</span> <span class="token punctuation">{</span>
        <span class="token comment">// 提供你的选项</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div><h3 id="markdown-extendmarkdown"><a href="#markdown-extendmarkdown" class="header-anchor">#</a> markdown.extendMarkdown</h3> <ul><li>类型: <code>Function</code></li> <li>默认值: <code>undefined</code></li></ul> <p>一个用于修改当前的 <a href="https://github.com/markdown-it/markdown-it" target="_blank" rel="noopener noreferrer">markdown-it<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 实例的默认配置，或者应用额外的插件的函数，举例如下：</p> <div class="language-js extra-class"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  markdown<span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token function-variable function">extendMarkdown</span><span class="token operator">:</span> <span class="token parameter">md</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
      md<span class="token punctuation">.</span><span class="token function">set</span><span class="token punctuation">(</span><span class="token punctuation">{</span> breaks<span class="token operator">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">)</span>
      md<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'markdown-it-xxx'</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div><div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>这个选项也被 <a href="/plugin/option-api.html#extendmarkdown">Plugin API</a> 所支持。</p></div> <h3 id="markdown-extractheaders"><a href="#markdown-extractheaders" class="header-anchor">#</a> markdown.extractHeaders</h3> <ul><li>类型: <code>Array</code></li> <li>默认值: <code>['h2', 'h3']</code></li></ul> <p>Markdown 文件的 headers (标题 &amp; 小标题) 会在准备阶段被提取出来，并存储在 <code>this.$page.headers</code> 中。默认情况下，VuePress 会提取 <code>h2</code> 和 <code>h3</code> 标题。你可以通过这个选项来修改提取出的标题级别。</p> <div class="language-js extra-class"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  markdown<span class="token operator">:</span> <span class="token punctuation">{</span>
    extractHeaders<span class="token operator">:</span> <span class="token punctuation">[</span> <span class="token string">'h2'</span><span class="token punctuation">,</span> <span class="token string">'h3'</span><span class="token punctuation">,</span> <span class="token string">'h4'</span> <span class="token punctuation">]</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div><h2 id="构建流程"><a href="#构建流程" class="header-anchor">#</a> 构建流程</h2> <h3 id="postcss"><a href="#postcss" class="header-anchor">#</a> postcss</h3> <ul><li>类型: <code>Object</code></li> <li>默认值: <code>{ plugins: [require('autoprefixer')] }</code></li></ul> <p><a href="https://github.com/postcss/postcss-loader" target="_blank" rel="noopener noreferrer">postcss-loader<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 的选项，请注意，指定这个值，将会覆盖内置的 autoprefixer，所以你需要自己将它加进去。</p> <h3 id="stylus"><a href="#stylus" class="header-anchor">#</a> stylus</h3> <ul><li>类型: <code>Object</code></li> <li>默认值: <code>{ preferPathResolver: 'webpack' }</code></li></ul> <p><a href="https://github.com/shama/stylus-loader" target="_blank" rel="noopener noreferrer">stylus-loader<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 的选项。</p> <h3 id="scss"><a href="#scss" class="header-anchor">#</a> scss</h3> <ul><li>类型: <code>Object</code></li> <li>默认值: <code>{}</code></li></ul> <p>加载 <code>*.scss</code> 文件的 <a href="https://github.com/webpack-contrib/sass-loader" target="_blank" rel="noopener noreferrer">sass-loader<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 的选项。</p> <h3 id="sass"><a href="#sass" class="header-anchor">#</a> sass</h3> <ul><li>类型: <code>Object</code></li> <li>默认值: <code>{ indentedSyntax: true }</code></li></ul> <p>加载 <code>*.sass</code> 文件的 <a href="https://github.com/webpack-contrib/sass-loader" target="_blank" rel="noopener noreferrer">sass-loader<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 的选项。</p> <h3 id="less"><a href="#less" class="header-anchor">#</a> less</h3> <ul><li>类型: <code>Object</code></li> <li>Default: <code>{}</code></li></ul> <p><a href="https://github.com/webpack-contrib/less-loader" target="_blank" rel="noopener noreferrer">less-loader<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 的选项。</p> <h3 id="configurewebpack"><a href="#configurewebpack" class="header-anchor">#</a> configureWebpack</h3> <ul><li>类型: <code>Object | Function</code></li> <li>默认值: <code>undefined</code></li></ul> <p>用于修改内部的 Webpack 配置。如果给定一个对象，那么它将会被 <a href="https://github.com/survivejs/webpack-merge" target="_blank" rel="noopener noreferrer">webpack-merge<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 合并到最终的配置中，如果给定一个函数，它将会接受 <code>config</code> 作为第一个参数，以及 <code>isServer</code> 作为第二个参数，你可以直接更改 <code>config</code>，也可以返回一个待合并的对象。</p> <div class="language-js extra-class"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  <span class="token function-variable function">configureWebpack</span><span class="token operator">:</span> <span class="token punctuation">(</span><span class="token parameter">config<span class="token punctuation">,</span> isServer</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>isServer<span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token comment">// 修改客户端的 webpack 配置</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div><h3 id="chainwebpack"><a href="#chainwebpack" class="header-anchor">#</a> chainWebpack</h3> <ul><li>类型: <code>Function</code></li> <li>默认值: <code>undefined</code></li></ul> <p>通过 <a href="https://github.com/mozilla-neutrino/webpack-chain" target="_blank" rel="noopener noreferrer">webpack-chain<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 来修改内部的 Webpack 配置。</p> <div class="language-js extra-class"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  <span class="token function-variable function">chainWebpack</span><span class="token operator">:</span> <span class="token punctuation">(</span><span class="token parameter">config<span class="token punctuation">,</span> isServer</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token comment">// config 是 ChainableConfig 的一个实例</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div><h2 id="浏览器兼容性"><a href="#浏览器兼容性" class="header-anchor">#</a> 浏览器兼容性</h2> <h3 id="evergreen"><a href="#evergreen" class="header-anchor">#</a> evergreen</h3> <ul><li>类型: <code>boolean | Function</code></li> <li>默认值: <code>false</code></li></ul> <p>如果你的对象只有那些 “常青树” 浏览器，你可以将其设置成 <code>true</code>，这将会禁止 ESNext 到 ES5 的转译以及对 IE 的 polyfills，同时会带来更快的构建速度和更小的文件体积。</p></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/vuejs/vuepress/edit/master/packages/docs/docs/config/README.md" target="_blank" rel="noopener noreferrer">在 GitHub 上编辑此页</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2021/1/23 下午1:08:04</span></div></footer> <!----> </main></div><div class="global-ui"><!----><!----></div></div>
    <script src="/assets/js/app.28715422.js" defer></script><script src="/assets/js/5.cdfc0b9f.js" defer></script><script src="/assets/js/22.32e1eb60.js" defer></script><script src="/assets/js/9.4c44b987.js" defer></script>
  </body>
</html>
